#ifndef BUSINESSUSER_H
#define BUSINESSUSER_H

#include <protocol/protocol.h>
#include <QJsonObject>
#include <UserManager/usermanager.h>

class BusinessUser
{
public:
    // 删除拷贝构造函数和拷贝赋值操作符
    BusinessUser(BusinessUser const&) = delete;
    BusinessUser& operator=(BusinessUser const&) = delete;
    // 提供一个全局唯一的接口
    static BusinessUser& getInstance() {
        static BusinessUser instance;
        return instance;
    }


    // init friend list
    void initUserList(std::shared_ptr<Protocol> protocol);

    // replyFriendApply
    void replyFriendApply(QJsonObject& in, QJsonObject& out);

    // apply friend
    void applyAddFriend(QJsonObject& in, QJsonObject& out);

    // apply For Refresh User List
    void applyForRefreshUserList(QJsonObject& in, QJsonObject& out);

    // getTargetUser
    User& getTargetUser(const std::string& account);
    User& getTargetUser(uint64_t id);

    // erase friend
    void eraseFriend(QJsonObject& in, QJsonObject& out);

    void addUser(std::shared_ptr<Protocol> protocol);

    // update local message
    void updateLocalMessage(QJsonObject& in, QJsonObject& out);

    // update avatar
    void updateAvatar(QJsonObject& in, QJsonObject& out);


private:

    BusinessUser();
};

#endif // BUSINESSUSER_H
